package com.strategyPattern.comtroller;

import com.strategyPattern.service.AmericanoCafe;
import com.strategyPattern.service.Cappuccino;
import com.strategyPattern.service.Coffee;
import com.strategyPattern.service.Latte;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class getCoffee {
    @Autowired
    AmericanoCafe americanoCafe;
    @Autowired
    Cappuccino cappuccino;
    @Autowired
    Latte latte;

    @RequestMapping("/price")
    @ResponseBody
    public int price(int type){
        int a = 0;
        if(type == 1){
            a = americanoCafe.getPrice();
        }else if(type == 2){
            a = cappuccino.getPrice();
        }else if(type == 3){
            a = latte.getPrice();
        }
        return  a;
    }
}
